function AcctContJsWindowOnLoad()
{

if (!crmFormSubmit.crmFormSubmitId.value && crmFormSubmit.crmFormSubmitId.value != "")
{
crmFormSubmit.attachEvent("onsubmit", AddAddressIds);
}
}

window.attachEvent('onload', AcctContJsWindowOnLoad);


function AddAddressIds()
{
var o = crmFormSubmit.crmFormSubmitXml;
var s = (crmFormSubmit.crmFormSubmitObjectType.value == Account) ? "account" : "contact";

o.value = o.value.replace("</" + s + ">", "<address1_addressid>" + CrmEncodeDecode.CrmXmlEncode(crmForm.address1_addressid.value) + "</address1_addressid><address2_addressid>" + CrmEncodeDecode.CrmXmlEncode(crmForm.address2_addressid.value) + "</address2_addressid></" + s + ">");

return true;
}

function AddRelatedAddress(iType)
{
var s = crmFormSubmit.crmFormSubmitId.value;
var i = crmFormSubmit.crmFormSubmitObjectType.value;

if (iType == CustomerAddress)
{
openFrmObj("?objecttypecode=" + i + "&addressnumber=0&parentid=" + s, buildWinName(), iType);
}
else
{
openObjEx(iType, i, s);
}
}